package org.hmh.leetcode.hashtable;

import java.util.HashSet;

public class code409_easy {

    static class Solution {
        public int longestPalindrome(String s) {
            HashSet<Character> map = new HashSet<>();
            int count = 0;
            for (int i = 0; i < s.length(); i ++) {
                if (map.contains(s.charAt(i))) {
                    map.remove(s.charAt(i));
                    count++;
                }else{
                    map.add(s.charAt(i));
                }
            }
            if(!map.isEmpty())
                return 2*count+1;
            else
                return 2 * count;
        }
    }

    public static void main(String[] args){

    }
}
